<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <h2>{{msg}}</h2>
    <!--  使用Vue实例中的isShow  -->
    <cpn v-show="isShow"></cpn>

</div>

<template id="cpn">
    <div>
        <h2>我是组件</h2>
        <!--  使用组件中的isShow   -->
        <p v-show="isShow">我是组件,我最强</p>
    </div>
</template>
<script src="../js/vue.js"></script>
<script>

    const cpn = {
        template: "#cpn",
        data() {
            return {
                isShow: false
            }
        }
    }
    const app = new Vue({
        el: "#app",
        data: {
            msg: "hello",
            isShow: true
        },
        components: {
            cpn: cpn
        }
    })
</script>

</body>
</html>